﻿using System;
using System.Collections.Generic;
using System.Linq;
using Dhtl.Service.IService;
using Dhtl_Repositry.Repository;

namespace Dhtl.Service.Service
{
    public class Service_thongtintuyensinh : IThongtintuyensinh
    {
        public List<DataBase.Daihoctuonglai.Thong_tin_tuyen_sinh> List()
        {
            using (Thongtintuyensinh_Repositry sv = new Thongtintuyensinh_Repositry())
            {
                return sv.List();
            }
        }

        public DataBase.Daihoctuonglai.Thong_tin_tuyen_sinh GetById(int id)
        {
            using (Thongtintuyensinh_Repositry sv = new Thongtintuyensinh_Repositry())
            {
                return sv.GetById(id);
            }
        }

        public List<DataBase.Daihoctuonglai.Thong_tin_tuyen_sinh> ListByCatetId(int id)
        {
            using (Thongtintuyensinh_Repositry sv = new Thongtintuyensinh_Repositry())
            {
                return sv.GetTableListById(id);
            }
        }

        public int AddOrUpdate(DataBase.Daihoctuonglai.Thong_tin_tuyen_sinh entity)
        {
            using (Thongtintuyensinh_Repositry sv = new Thongtintuyensinh_Repositry())
            {
                return sv.CreateOrUpdate(entity);
            }
        }

        public void delete(int id)
        {
            using (Thongtintuyensinh_Repositry sv = new Thongtintuyensinh_Repositry())
            {
                sv.Delete(id);
            }
        }
    }
}
